package ncku.account.data;

import java.util.ArrayList;

public class SubTransactionList {
	public ArrayList<SubTransaction> subTransactions;
	
	//new a subTransaction ArrayList
	public SubTransactionList(){
		subTransactions = new ArrayList<SubTransaction>();
	}
	
	//add item on subTransaction ArrayList
	public void addSubTrans(String description, int amount){
		SubTransaction subTrans = new SubTransaction(description,amount);
		subTransactions.add(subTrans);
	}
	
	//edit subTransaction
	public void editSubTrans(int index, String description, int amount){
		SubTransaction subTrans = new SubTransaction(description,amount);
		subTransactions.set(index,subTrans);
	}
	
	//Delete subTransaction
	public void deleteSubTrans(int index){
		subTransactions.remove(index);
	}
	
	//get the whole SubTransaction ArrayList
	public ArrayList<SubTransaction> getArrayListSubTrans(){
		return this.subTransactions;
	}
	
	//讀取sub Transaction中的某一項
	public SubTransaction getSubTrans(int index){
		return this.subTransactions.get(index);
	}
	
	//get the size of whole SubTransaction ArrayList
	public int getSize(){
		return this.subTransactions.size();
	}
}
